﻿package config.poker;

import org.json.simple.JSONObject;

import util.KIntChange;
import util.KJsonObject;
import util.KPrintInfo;
import config.LoadFile;

public class PokerConfig {
	static private PokerConfig	pokerConfig	= new PokerConfig();
	private JSONObject			jsonObject;
	
	// 报名
	private int					Poker_sign_up;
	// 人数够了
	private int					Poker_people_Enough;
	// 准备
	private int					Poker_ready;
	// 发牌
	private int					Poker_send;
	// 发完
	private int					Poker_send_Complete;
	// 抢地主
	private int					Poker_RobLead_start;
	// 抢地主的倍数
	private int					Poker_RobLead_Times;
	// 确定地主
	private int					Poker_RobLead_enter;
	// 开始出牌
	private int					Poker_Play_Card_start;
	// 出牌
	private int					Poker_Play_Card_send;
	// 过
	private int					Poker_Play_Card_pass;
	// 下轮的先手
	private int					Poker_Play_Card_Next_Frist;
	// 牌出完
	private int					Poker_send_over;
	// 嬴家
	private int					Poker_Winer;
	
	// 有人退出
	private int					SomeOneExit;
	
	public int getPoker_RobLead_Times() {
		return Poker_RobLead_Times;
	}
	
	public static PokerConfig getInstance() {
		return pokerConfig;
	}
	
	public void init() {
		if (loadConfing()) {
			KPrintInfo.println("Poker----config----加载配置文件成功");
		} else {
			KPrintInfo.println("Poker----config----加载配置文件失败");
		}
	}
	
	// 加载配置文件
	public Boolean loadConfing() {
		LoadFile loadFile = new LoadFile();
		
		String fileString = loadFile.Load("config/poker/pokerConfig");
		jsonObject = KJsonObject.decode(fileString);
		
		return initConfigData();
	}
	
	private Boolean initConfigData() {
		Poker_sign_up = KIntChange.intChange(jsonObject.get("Poker_sign_up"));
		Poker_ready = KIntChange.intChange(jsonObject.get("Poker_ready"));
		Poker_send = KIntChange.intChange(jsonObject.get("Poker_send"));
		Poker_send_Complete = KIntChange.intChange(jsonObject.get("Poker_send_Complete"));
		Poker_RobLead_start = KIntChange.intChange(jsonObject.get("Poker_RobLead_start"));
		Poker_RobLead_enter = KIntChange.intChange(jsonObject.get("Poker_RobLead_enter"));
		Poker_Play_Card_start = KIntChange.intChange(jsonObject.get("Poker_Play_Card_start"));
		Poker_Play_Card_send = KIntChange.intChange(jsonObject.get("Poker_Play_Card_send"));
		Poker_Play_Card_pass = KIntChange.intChange(jsonObject.get("Poker_Play_Card_pass"));
		Poker_Play_Card_Next_Frist = KIntChange.intChange(jsonObject.get("Poker_Play_Card_Next_Frist"));
		Poker_send_over = KIntChange.intChange(jsonObject.get("Poker_send_over"));
		Poker_Winer = KIntChange.intChange(jsonObject.get("Poker_Winer"));
        Poker_people_Enough = KIntChange.intChange(jsonObject.get("Poker_people_Enough"));
		Poker_RobLead_Times = KIntChange.intChange(jsonObject.get("Poker_RobLead_Times"));
		SomeOneExit=KIntChange.intChange(jsonObject.get("SomeOneExit"));
		return true;
	}
	
	public int getPoker_sign_up() {
		return Poker_sign_up;
	}
	
	public int getPoker_ready() {
		return Poker_ready;
	}
	
	public int getPoker_send() {
		return Poker_send;
	}
	
	public int getPoker_send_Complete() {
		return Poker_send_Complete;
	}
	
	public int getPoker_RobLead_start() {
		return Poker_RobLead_start;
	}
	
	public int getPoker_RobLead_enter() {
		return Poker_RobLead_enter;
	}
	
	public int getPoker_Play_Card_start() {
		return Poker_Play_Card_start;
	}
	
	public int getPoker_Play_Card_send() {
		return Poker_Play_Card_send;
	}
	
	public int getPoker_Play_Card_pass() {
		return Poker_Play_Card_pass;
	}
	
	public int getPoker_Play_Card_Next_Frist() {
		return Poker_Play_Card_Next_Frist;
	}
	
	public int getPoker_send_over() {
		return Poker_send_over;
	}
	
	public int getPoker_Winer() {
		return Poker_Winer;
	}
	
	public int getPoker_people_Enough() {
		return Poker_people_Enough;
	}
	public int getSomeOneExit(){
		return SomeOneExit;
	}
	// end class
}
